<template>
	<view>
		<scroll-view :scroll-y="modalName==null" class="page" :class="modalName!=null?'show':''">
			
			<view class="cu-list menu">
				<view class="cu-item ">
					<view class="content">
						<text class="text-grey">税前月薪</text>
					</view>
					<view class="action">
						<input class="input" type="digit" :maxlength="15" v-model="realPay"
						placeholder="请输入" placeholder-class="placeholder" />
					</view>
				</view>
				<view class="cu-item ">
					<view class="content">
						<text class="text-grey">月应扣社保</text>
					</view>
					<view class="action">
						<input class="input" type="digit" :maxlength="10" v-model="scAmonut"
						placeholder="请输入" placeholder-class="placeholder" />
					</view>
				</view>
				<view class="cu-item ">
					<view class="content">
						<text class="text-grey">月应扣公积金</text>
					</view>
					<view class="action">
						<input class="input" type="digit" :maxlength="10" v-model="fund"
						placeholder="请输入" placeholder-class="placeholder" />
					</view>
				</view>
				
				<view class="cu-item ">
					<view class="content">
						<text class="text-grey">月专项扣除金额</text>
					</view>
					<view class="action">
						<input class="input" type="digit" :maxlength="10" v-model="deduction"
						placeholder="请输入" placeholder-class="placeholder" />
					</view>
				</view>
				
				<view class="cu-item bottom">
					<view class="content">
						<view class="cu-btn round bg-blue" @tap="goPage('/pages/tabbar/tabbar-2/personTaxResult')">查看测算结果</view>
					</view>
				</view>
			</view>

		</scroll-view>
	<!-- 绑定 -->
	<goReg 
		ref="goReg" 
		:contentHeight="580"
	></goReg>
	</view>
</template>

<script>
	import goReg from "@/components/goReg";
	export default {
		components: {
			goReg,
		},
		data() {
			return {
				realPay:'',
				scAmonut:'',
				fund:'',
				deduction:'',
				resultData:'',
				modalName: null,
			};
		},
		methods: {
			goPage(page){
				// let uId = uni.getStorageSync('userId');
				let uId =1
				if(uId>"0"&&uId!=undefined){
					let errMsg = '';
					if(this.deduction<=0)errMsg = '请填写月专项扣除金额';
					if(this.fund<=0)errMsg = '请填写月应扣公积金';
					if(this.scAmonut<=0)errMsg = '请填写月应扣社保';
					if(this.realPay<=0)errMsg = '请填写税前月薪';
					if(errMsg){
						uni.showToast({
							title:errMsg,
							icon:'none',
						});
						return;
					}
					
					uni.setStorageSync('taxParam',{wages:this.realPay,social:this.scAmonut,fund:this.fund,deduct:this.deduction,
					collection_rate:0,service_rate:0,type:2});
					uni.navigateTo({
						url: page
					})
					return;
				}
				
				this.$refs.goReg.showModal('regModal');	
				return;
				
			},
		}
	}
</script>

<style>
	.page {
		height: 100Vh;
		width: 100vw;
		background: #F6F6F6;
		
		
	}
	.cu-btn{
		height: 80rpx;
		width: 80%;
		margin: 0 10%;
		box-shadow: 0px 3px 6px #4CA5FE;
	}
	.cu-list.menu>.bottom{
		position: fixed !important;
		width: 100%;
		bottom: 10px;
		background: transparent;
		margin-left: -10px;
		padding: 0;
	}
	.cu-list{
		height: 375px;
		background: #FFFFFF;
		box-shadow: 0px 3px 6px rgba(142, 228, 255, 0.12);
		opacity: 1;
		border-radius: 10px;
		margin: 20px 10px;
	}
	.page.show {
		overflow: hidden;
	}
	.input{
		text-align: right;
		font-size: 12px;
	}
	.switch-sex::after {
		content: "\e716";
	}

	.switch-sex::before {
		content: "\e7a9";
	}

	.switch-music::after {
		content: "\e66a";
	}

	.switch-music::before {
		content: "\e6db";
	}
</style>
